#!/usr/bin/perl -- # -*-Perl-*-

# A gopher+ application to process $ave suggestion forms 

# The following email address will get the suggestion form
$email = "dal@boombox.micro.umn.edu";

# Read in the variables

$ILine1 = <>;
$ILine2 = <>;
$ILine3 = <>;
$ILine4 = <>;
$Iaffects = <>;
$Ilabor = <>;
$Isupply = <>;
$Iproductivity = <>;
$Ispace = <>;
$Iequipment = <>;
$Iservice = <>;
$Isafety = <>;
$Ienvironment = <>;
$Iother = <>;
$Isave_because = <>;
$Isave = <>;
$Isave_amount = <>;
$Ireduce = <>;
$Ireduce_amount = <>;
$Idont_know = <>;
$Iname = <>;
$Ititle = <>;
$Idepartment = <>;
$Iaddress = <>;
$Iphone = <>;

# Make the variables secure

$ILine1 =~ m/^(.*)$/;
$Line1 = $1;
$ILine2 =~ m/^(.*)$/;
$Line2 = $1;
$ILine3 =~ m/^(.*)$/;
$Line3 = $1;
$ILine4 =~ m/^(.*)$/;
$Line4 = $1;
$Iaffects =~ m/^(.*)$/;
$affects = $1;
$Ilabor =~ m/^(.*)$/;
$labor = $1;
$Isupply =~ m/^(.*)$/;
$supply = $1;
$Iproductivity =~ m/^(.*)$/;
$productivity = $1;
$Ispace =~ m/^(.*)$/;
$space = $1;
$Iequipment =~ m/^(.*)$/;
$equipment = $1;
$Iservice =~ m/^(.*)$/;
$service = $1;
$Isafety =~ m/^(.*)$/;
$safety = $1;
$Ienvironment =~ m/^(.*)$/;
$environment = $1;
$Iother =~ m/^(.*)$/;
$other = $1;
$Isave_because =~ m/^(.*)$/;
$save_because = $1;
$Isave =~ m/^(.*)$/;
$save = $1;
$Isave_amount =~ m/^(.*)$/;
$save_amount = $1;
$Ireduce =~ m/^(.*)$/;
$reduce = $1;
$Ireduce_amount =~ m/^(.*)$/;
$reduce_amount = $1;
$Idont_know =~ m/^(.*)$/;
$dont_know = $1;
$Iname =~ m/^(.*)$/;
$name = $1;
$Ititle =~ m/^(.*)$/;
$title = $1;
$Idepartment =~ m/^(.*)$/;
$department = $1;
$Iaddress =~ m/^(.*)$/;
$address = $1;
$Iphone =~ m/^(.*)$/;
$phone = $1;


if ($name eq '') {
    print "You must enter your name.\nPlease try again.\n";
    exit(1);
}

if ($department eq '') {
    print "You must enter your department.\nPlease try again.\n";
    exit(1);
}

if ($Line1 eq '') {
    print "You must enter some way of saving money.\nPlease try again.\n";
    exit(1);
}


# Put the lines, including mail headers, on a stack to be processed

push(@lines,"From: <Gopher+ Client>\n");
push(@lines,"To: $email\n");
push(@lines,"Subject: This will save us all money\n");
#push(@lines,"Bcc: \n");
push(@lines,"\n\n");
push(@lines,"        U N I V E R S I T Y  O F  M I N N E S O T A\n");
push(@lines,"           \$ A V E  S U G G E S T I O N  F O R M\n");
push(@lines,"        ==================================================\n\n");
push(@lines,"Here's what I think should be done and where, when,\n");
push(@lines,"and by whom it should be done:\n\n");
push(@lines,"$Line1\n");
push(@lines,"$Line2\n");
push(@lines,"$Line3\n");
push(@lines,"$Line4\n\n\n");
push(@lines,"My suggestion affects the following areas or");
push(@lines,"departments:\n\n");
push(@lines,"$affects\n\n\n");
push(@lines,"My suggestion will (Check all that apply):\n");
push(@lines,"_ $labor _  reduce labor cost                ");
push(@lines,"_ $equipment _  reduce equipment costs\n");
push(@lines,"_ $supply _  reduce material or suppply cost  ");
push(@lines,"_ $service _  improve service\n");
push(@lines,"_ $productivity _  improve productivity             ");
push(@lines,"_ $safety _  improve safety\n");
push(@lines,"_ $space _  make better use of space         ");
push(@lines,"_ $environment _  improve the environment\n");
push(@lines,"       other (please describe)\n\n");
push(@lines,"$other\n\n\n");
push(@lines,"My suggestion will save money or increase revenue ");
push(@lines,"each year because:\n\n");
push(@lines,"$save_because\n\n\n");
push(@lines,"My suggestion will (check all that apply and provide ");
push(@lines,"information):\n");
push(@lines,"_ $save _  save \$ $save_amount annually\n");
push(@lines,"_ $reduce _  reduce expenses by \$ $reduce_amount ");
push(@lines,"annually\n");
push(@lines,"_ $dont_know _  I don't know how to estimate the ");
push(@lines,"amount\n\n\n");
push(@lines,"Name:       $name\n");
push(@lines,"Title:      $title\n");
push(@lines,"Department: $department\n");
push(@lines,"Address:    $address\n");
push(@lines,"Phone:      $phone\n");

# Open the sendmail handle

open(EMAIL,"|/usr/lib/sendmail -t");
print EMAIL @lines;
close(EMAIL);

print "The Following $ave suggestion form was mailed to:\n\n";
print "$email\n\n";
print "=====================================================\n";
print @lines;

# End of Main Program

